package com.wuliner.unlock_new

import android.content.Context
import android.content.res.ColorStateList
import android.graphics.Color
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import android.widget.EditText
import android.widget.LinearLayout
import android.widget.TextView

class InputView(context: Context, attrs: AttributeSet): LinearLayout(context, attrs)  {
    var alertTitle: TextView
    var editText: EditText

    init {
        LayoutInflater.from(context).inflate(R.layout.input_filed, this)
        alertTitle = findViewById(R.id.alertTitle)
        editText = findViewById(R.id.editText)
    }

    //改变颜色
    fun changeState(isRight: Boolean) {
        if (!isRight) {
            alertTitle.setTextColor(Color.RED)
            //editText.setTextColor(Color.RED)
        } else {
            alertTitle.setTextColor(Color.BLACK)
            //editText.setTextColor(Color.BLACK)
        }
    }

    //设置标题信息
    fun setAlertText(msg: String) {
        alertTitle.text = msg
    }
    //设置输入框提示信息
    fun setEditHint(msg: String) {
        editText.hint = msg
    }

}
